<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>jsx语法规则</title>
    <style>
      .title {
        color: pink;
      }
    </style>
  </head>

  <body>
    <div id="test"></div>
    <script
      src="https://unpkg.com/react@16/umd/react.development.js"
      crossorigin
    ></script>
    <script
      src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"
      crossorigin
    ></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <script type="text/babel">
      const myId = "TitLe";
      const myData = "hello react";
      const vdom = (
        <div>
          <h1 id={myId} className="title">
            <span style={{ color: "orange" }}>{myData}</span>
          </h1>
          <h1 id={myId} className="title1">
            <span style={{ color: "pink" }}>{myData}</span>
          </h1>
          <input type="text" />
        </div>
      );
      ReactDOM.render(vdom, document.getElementById("test"));
      /*
      jsx语法规则：
      1.定义虚拟dom时，不要写引号
      2.标签中部混入js表达式时要用{}
      3.样式的类名指定不要用class,要用className
      4.内联样式要用style={{key:value}}写
      5.虚拟dom必须只有一个跟标签
      6.标签必须闭合
      7.标签首字母   
        7.1小写字母开头，则将标签转为html中同名元素，若html无改标签对应的同名元素则报错
        7.2若大写字母开头，react就去渲染对应的组件，若组件没有定义，则报错
      */
    </script>
  </body>
</html>
